import types

class Cylinder:
    def __init__(self, radius=1, height=1):
        self.radius = radius
        self.height = height

def set_radius(self, radius):
    self.radius = radius

def set_height(cls, height):
    cls.height = height

# 为对象绑定SetRadius
cylinder = Cylinder()
cylinder.SetRadius = types.MethodType(set_radius, cylinder)

# 为类Cylinder绑定SetHeight
Cylinder.SetHeight = classmethod(set_height)
